package com.qf.blogsystem.core.utils;

import org.mindrot.jbcrypt.BCrypt;

/**
 * @author Crazy
 * @version 1.0
 * @description: 密码加密工具类
 * @date 2022/12/6 0:24
 */
public class EncryptUtils {
    /**
     * 密码加密
     * @param password
     * @return String
     */
    public static String encrypt(String password) {
        return BCrypt.hashpw(password, BCrypt.gensalt());
    }

    /**
     * 密码校验
     * @param password
     * @param opassword
     * @return boolean
     */
    public static boolean check(String password, String opassword) {
        return BCrypt.checkpw(password, opassword);
    }
}
